//
//  CYMinePropertyTopCell.m
//  cyjf
//
//  Created by tauCross on 2017/5/17.
//  Copyright © 2017年 Auto Financing. All rights reserved.
//

#import "CYMinePropertyTopCell.h"



@implementation CYMinePropertyTopCellObject

@end


@interface CYMinePropertyTopCell ()

@property(nonatomic, strong)UILabel *totalPropertyDescLabel;
@property(nonatomic, strong)UILabel *totalPropertyLabel;

@end


@implementation CYMinePropertyTopCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if(self)
    {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        
        self.totalPropertyDescLabel = [[UILabel alloc] init];
        self.totalPropertyDescLabel.text = @"总资产(元)";
        self.totalPropertyDescLabel.font = [UIFont systemFontOfSize:12];
        self.totalPropertyDescLabel.textColor = HEXCOLOR(@"999999");
        [self.totalPropertyDescLabel sizeToFit];
        [self.contentView addSubview:self.totalPropertyDescLabel];
        
        self.totalPropertyLabel = [[UILabel alloc] init];
        self.totalPropertyLabel.font = [UIFont systemFontOfSize:38];
        self.totalPropertyLabel.textColor = HEXCOLOR(@"444444");
        [self.contentView addSubview:self.totalPropertyLabel];
    }
    return self;
}

+ (CGFloat)heightForObject:(id)object atIndexPath:(NSIndexPath *)indexPath tableView:(UITableView *)tableView
{
    return 135;
}

- (BOOL)shouldUpdateCellWithObject:(CYMinePropertyTopCellObject *)object
{
    self.totalPropertyLabel.text = object.totalProperty.amountString;
    
    [self setNeedsLayout];
    return YES;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    
    self.totalPropertyDescLabel.centerX = self.contentView.width / 2;
    self.totalPropertyDescLabel.centerY = 46;
    
    [self.totalPropertyLabel sizeToFit];
    self.totalPropertyLabel.centerX = self.contentView.width / 2;
    self.totalPropertyLabel.centerY = 76;
}

@end
